<template>
  <div>
    <web-view :src="web_url" v-if="web_url" @message="handleGetMessage"></web-view>
  </div>
</template>
<script>
import {mapActions} from 'vuex';
const {webviewDomain,env}=require('../../config')
export default {
  data(){
    return{
      web_url:''
    }
  },
  onLoad(options){
    if(options.imgUrl){
      if(options.imgIndex){
          this.web_url=`${webviewDomain}?imgUrl=${options.imgUrl}&imgIndex=${options.imgIndex}&imgId=${options.imgId}&from=${env}`
      }else{
        this.web_url=`${webviewDomain}?imgUrl=${options.imgUrl}&imgId=${options.imgId}&from=${env}`
      }
      console.log(this.web_url)
    }
  },
  methods: {
    ...mapActions(['setImgData']),
    handleGetMessage(e){
      this.setImgData(e.target.data);
    }
  },
}
</script>